<?php
/**
 * Created by PhpStorm.
 * User: huangxl
 * Date: 2018/3/28
 * Time: 14:21
 */

namespace app\autos\controller;

use think\Controller;

class Hook extends Controller
{

    private $server_dir = "/home/development/AragakiYui-hxl";
    private $pass = "zlG5PDO41NMkLQWqPHH3";

    /*
    * hook git auto pull
    * */
    public function auto_pull(){
        $password = input('post.password/s');
        if ($password==$this->pass){
            $cmd = "cd $this->server_dir && git pull";
            $output = exec($cmd);
            echo "<pre>cmd:<$cmd> code: <$output></pre>";
        }else
            echo "密码校验失败!";
    }

}